import Vue from "vue";
import Vuex from "vuex";
import { savesessionStorage, delsessionStorage, getsessionStorage } from '../sessionStorage/index'
Vue.use(Vuex);


export default new Vuex.Store({
  state: {
    userInfo: getsessionStorage('userInfo') || {},
    adminUserInfo: getsessionStorage('adminUserInfo') || {}
  },
  mutations: {
    setuserInfo(state, data) {
      savesessionStorage('userInfo', data)
      state.userInfo = data
    },
    setadminUserInfo(state, data) {
      savesessionStorage('adminUserInfo', data)
      state.adminUserInfo = data
    }
  },
  getters: {
    getuserInfo: state => state.userInfo,
    getadminUserInfo: state => state.adminUserInfo
  }
});
